package game.mapEditor;

import processing.core.PImage;
import game.map.Static;
import game.map.TiledMap;

public class MapInEdition extends TiledMap {

//	public MapInEdition(int tilesX, int tilesY, int initZoom, int panelWidth,
//			int panelHeight, PApplet app) {
//		super(tilesX, tilesY, initZoom, panelWidth, panelHeight, app);
//	}

	public MapInEdition(WsAppletMapEditor app) {
		super(app);
	}

	public MapInEdition(WsAppletMapEditor app, String size) {
		super(app);
		int sizeInt = (size.equals("SMALL")) ? 20 : ((size.equals("MEDIUM")) ? 30 : 60);
		tilesX = sizeInt;
		tilesY = sizeInt;
		verticalWalls = new int[tilesY][tilesX - 1];
		horizontalWalls = new int[tilesY - 1][tilesX];
	}

//	public void zoom(int i) {
//		zoom -= i;
//		System.out.println("zoom: " + zoom);
//	}
	
	public void setWall(int centerX, int centerY) {
		// {v/h, x, y}
		int[] wall = getWall(app.mouseX + centerX, app.mouseY + centerY);
		if (wall == null)
			return;
		
		if (wall[0] == Static.VERTICAL)
			verticalWalls[wall[1]][wall[2]] = 
					(verticalWalls[wall[1]][wall[2]] + 1) % 4;
		else // HORIZONTAL
			horizontalWalls[wall[2]][wall[1]] = 
					(horizontalWalls[wall[2]][wall[1]] + 1) % 4;
		
	}

	public int getSide() {
		return side;
	}

	public int getTilesX() {
		return tilesX;
	}
	public int getTilesY() {
		return tilesY;
	}

	public PImage getBackgroundImg() {
		return backgroundImg;
	}

	public void setBackgroundImg(PImage loadImage) {
		this.backgroundImg = loadImage;
	}

}
